using UniversalAdmin.Application.Dtos.File;

namespace UniversalAdmin.Application.Services.Interfaces;

/// <summary>
/// 文件服务接口
/// </summary>
public interface IFileService
{
    /// <summary>
    /// 上传文件
    /// </summary>
    /// <param name="fileName">文件名</param>
    /// <param name="originalName">原始文件名</param>
    /// <param name="contentType">内容类型</param>
    /// <param name="size">文件大小</param>
    /// <param name="filePath">文件路径</param>
    /// <param name="userId">用户ID</param>
    /// <returns>文件信息</returns>
    Task<FileDto> SaveFileInfoAsync(string fileName, string originalName, string contentType, long size, string filePath, Guid? userId = null);

    /// <summary>
    /// 根据ID获取文件信息
    /// </summary>
    /// <param name="id">文件ID</param>
    /// <returns>文件信息</returns>
    Task<FileDto?> GetByIdAsync(Guid id);

    /// <summary>
    /// 获取文件列表
    /// </summary>
    /// <param name="pageIndex">页码</param>
    /// <param name="pageSize">每页数量</param>
    /// <param name="keyword">搜索关键词</param>
    /// <param name="mimeType">文件类型</param>
    /// <param name="userId">用户ID</param>
    /// <returns>分页文件列表</returns>
    Task<(IEnumerable<FileDto> Items, int TotalCount)> GetFilesAsync(
        int pageIndex = 1,
        int pageSize = 10,
        string? keyword = null,
        string? mimeType = null,
        Guid? userId = null);

    /// <summary>
    /// 删除文件
    /// </summary>
    /// <param name="id">文件ID</param>
    /// <returns>操作结果</returns>
    Task<bool> DeleteFileAsync(Guid id);

    /// <summary>
    /// 获取文件信息（不包含用户信息）
    /// </summary>
    /// <param name="id">文件ID</param>
    /// <returns>文件信息</returns>
    Task<UniversalAdmin.Domain.Entities.App.File?> GetFileEntityAsync(Guid id);
}
